

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.lovo.vo.TreeNode"%>
<%@page import="com.lovo.vo.Sec_Role_Oper"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List<TreeNode> list = (List<TreeNode>)request.getAttribute("list");
List<Sec_Role_Oper> list1=(List<Sec_Role_Oper>)request.getAttribute("list1");
%>

<%!
	public String getsons(TreeNode root,List<Sec_Role_Oper> list){
	String result = " ";
	if(root.getChildren().size()>0){
		result = result + "<ul>";
		for(TreeNode son:root.getChildren()){
			result = result+"<li>";
			result = result+"<a tname='opercode' tvalue='"+son.getOpercode()+"'";
			for(Sec_Role_Oper l:list){
			  if(son.getOpercode().equals(l.getOpercode())){
			  result = result+"checked";
			  }
			}
			result = result+" href=\"javascript:void(0);\"><span style='display:none'>"+son.getId()+"</span><span>"+son.getText()+"</span></a>";
			result = result + getsons(son,list);
			result = result+"</li>";
		
			
		}
		result = result + "</ul>";
	}
	return result;
	}

%>

<div style="float:left; display:block; margin:10px; overflow:auto; width:98%; height:95%; border:solid 1px #CCC; line-height:21px; background:#FFF;">
<form  onsubmit="return validateCallback(this,navTabAjaxDone)" action="<%=basePath %>role/updaterolecode.do" method="post">
<input type="hidden" name="roleid" value="${requestScope.roleid }"/>
<%
	for(TreeNode root:list){
	%>
<ul class="tree treeFolder treeCheck expand" id="aul">
	<li><a href="javascript:void(0);" tname='opercode' tvalue="<%= root.getOpercode()%>"><span style='display:none'><%= root.getId()%></span><span><%= root.getText()%></span></a>	
	<%
	out.write(getsons(root,list1));
		
	%>
	</li>
</ul>
<%	   

		}
	%>
<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit" >保存</button></div></div></li>
			</ul>
		</div>
</form>
</div>

